<?php
class Slash_Client_VEvent
extends Slash_Client_ICalendarObject
{
	protected $OBJNAME = "VEVENT";
	
	public function getDtStart()
	{
		$result;
		$dtStart = $this->lines["DTSTART"];
		if (is_array($dtStart))
		{
			$tz = new DateTimeZone($dtStart["tzid"]);
			$result = new DateTime($dtStart["date"], $tz);
		} else {
			$result = new DateTime($dtStart);
		}
		return $result;
	}

	public function getDtEnd()
	{
		$result;
		if (isset($this->lines["DTEND"]))
		{
			$dtEnd = $this->lines["DTEND"];
			if (is_array($dtEnd))
			{
				$tz = new DateTimeZone($dtEnd["tzid"]);
				$result = new DateTime($dtEnd["date"], $tz);
			} else {
				$result = new DateTime($dtEnd);
			}
		} else if (isset($this->lines["DURATION"]))
		{
			//TODO: Compute it.
			return "Fixme: there's a duration";
		}
		return $result;
	}
	
	public function getDescription()
	{
		if (isset($this->lines["DESCRIPTION"]))
		{
			return Slash_Client_Client::unescapeText($this->lines["DESCRIPTION"]);
		} else {
			return null;
		}
	}

	public function getLocation()
	{
		if (isset($this->lines["LOCATION"]))
		{
			return Slash_Client_Client::unescapeText($this->lines["LOCATION"]);
		} else {
			return null;
		}
	}
	
	public function getSummary()
	{
		if (isset($this->lines["SUMMARY"]))
		{
			return Slash_Client_Client::unescapeText($this->lines["SUMMARY"]);
		} else {
			return null;
		}
	}
}
?>